import Taro, {Component} from '@tarojs/taro'
import {View,Text} from '@tarojs/components'

import './protocol.scss'

import DataManager from '../../utils/DataManager.js'

export default class promotionPage extends Component{

  config = {
    navigationBarTitleText: ''
  }

  onPullDownRefresh(){
    Taro.stopPullDownRefresh();
  }

  constructor(props) {
    super(props)
  }

  componentDidMount() {
    Taro.setNavigationBarTitle({
      title: DataManager.getAddressName() + '推广提示'
    })
  }

  onMobileClick = () =>{
    if (DataManager.getProxyMobile()){
      Taro.makePhoneCall({
        phoneNumber : DataManager.getProxyMobile()
      })
    }
  }

  onCopyWexin = () =>{
    if (DataManager.getProxyWeixinCode()){
      Taro.setClipboardData({
        data: DataManager.getProxyWeixinCode(),
        success: function() {
          Taro.showToast({
            title:'微信号复制成功',
            icon:'none'
          })
        }
      })
    }
  }

  render() {
    return (
      <View className='promotion-text' >
        <View>为获取更多的客源转换，用户如有推广需求，可通过以下两种方式联系本站主进行操作：</View>
        <View style='margin-left:20px'>1.添加站主微信号：</View>
        <View style='margin-left:20px' className='promotion-sub-container'>
          <View style='margin-left:10px;color:#ff4a43' onClick={this.onCopyWexin.bind(this)}>{DataManager.getProxyWeixinCode()}</View>
        </View>
        <View style='margin-left:20px' >2.拨打站主电话号：</View>
        <View style='margin-left:20px' className='promotion-sub-container'>
          <Text style='margin-left:10px;color:#ff4a43;text-decoration:underline' onClick={this.onMobileClick.bind(this)}>{ DataManager.getProxyMobile()}</Text>
        </View>
        {/*<View style='height:20px' />*/}
        {/*<View>为优惠用户，发布信息在相关页面置顶推荐以下方式：</View>*/}
        {/*<View style='margin-left:20px'>1.信息置顶5元／天</View>*/}
        {/*<View style='margin-left:20px'>2.信息置顶30元／10天</View>*/}
        {/*<View style='margin-left:20px'>3.信息置顶100元／30天</View>*/}
        <View style='height:20px' />
        <View>广告位投放（代做广告图片统一100元／张）：</View>
        <View style='margin-left:20px'>1.广告位广告10元／天</View>
        <View style='margin-left:20px'>2.广告位广告60元／10天</View>
        <View style='margin-left:20px'>3.广告位广告500元／30天</View>
        <View style='height:20px' />
        <View>积分获取方式：</View>
        <View style='margin-left:20px'>邀请好友成功授权登陆获得5积分，每天500积分封顶</View>
      </View>
    )
  }

}


